<template>
  <view>
    <view v-if="div_vip" :class="'mask2 ' + mask_class" data-maskid="div_vip" @tap="mask_closeFn">
      <view :style="'--div_box_width:600rpx;--div_box_height:' + (div_vip_H > 0 ? div_vip_H : 480) + 'rpx;'"
            class="div_box div_vip"
            @tap.stop.prevent="emptyFn">
        <view class="closebtm ico" data-maskid="div_vip" @tap.stop.prevent="mask_closeFn"></view>
        <view class="h1">{{ div_vip_title }}</view>
        <text v-if="!globalUtils.empty(div_vip_content)" class="C S15">{{ div_vip_content }}</text>
        <block v-else>
          <view class="C S15">开通VIP超级会员，专享超值权益</view>
          <view class="C S15">相亲成功率大大提升</view>
        </block>
        <view class="ico picico"></view>
        <view class="btn_btm btn44 ico" @tap.stop.prevent="vipFn"> 立即开通</view>
      </view>
    </view>
    <view v-if="div_cert" :class="'mask2 ' + mask_class" data-closekind="back" data-maskid="div_cert"
          @tap="mask_closeFn">
      <view class="div_box div_cert" style="--div_box_width: 600rpx; --div_box_height: 480rpx"
            @tap.stop.prevent="emptyFn">
        <view class="closebtm ico" data-closekind="back" data-maskid="div_cert" @tap.stop.prevent="mask_closeFn">
        </view>
        <view class="h1">{{ div_cert_title }}</view>
        <view class="C S15">成为认证用户，即享沟通特权</view>
        <view class="C S15">提高诚信值，杜绝虚假</view>
        <view class="ico picico"></view>
        <view class="btn_btm btn44 ico" @tap.stop.prevent="certFn">立即认证</view>
      </view>
    </view>
    <view v-if="div_data" :class="'mask2 ' + mask_class" data-closekind="back" data-maskid="div_data"
          @tap="mask_closeFn">
      <view :style="'--div_box_width:600rpx;--div_box_height:490rpx;--color:' + color + ';--rgbcolor:' + rgbcolor"
            class="div_box div_data"
            @tap.stop.prevent="emptyFn">
        <view class="closebtm ico" data-closekind="back" data-maskid="div_data" @tap.stop.prevent="mask_closeFn">
        </view>
        <view class="h1">{{ div_data_title }}</view>
        <view class="C S15">赶快去完善，解锁更多功能</view>
        <view class="C S15">完成资料，上传头像，受关注度暴增</view>
        <view class="C S15 Cf00">如果还未审核，请等待审核</view>
        <view class="ico picico"></view>
        <view class="btn_btm btn44 ico" @tap.stop.prevent="dataFn">立即完善</view>
      </view>
    </view>
    <view v-if="div_gps" :class="'mask2 ' + mask_class" data-closekind="back" data-maskid="div_gps" @tap="mask_closeFn">
      <view :style="'--div_box_width:550rpx;--div_box_height:480rpx;--color:' + color + ';--rgbcolor:' + rgbcolor"
            class="div_box div_gps"
            @tap.stop.prevent="emptyFn">
        <view class="closebtm ico" data-closekind="back" data-maskid="div_gps" @tap.stop.prevent="mask_closeFn"></view>
        <view class="h1">{{ div_gps_title }}</view>
        <view class="C S15">授权后，将自动获取您当前位置</view>
        <view class="C S15">否则将无法使用《附近的人》功能</view>
        <view class="ico picico"></view>
        <view class="btn_btm btn44 ico" @tap.stop.prevent="gpsFn">同意获取位置</view>
      </view>
    </view>
  </view>
</template>
<script>
import globalUtils from "../../res/www.a9a.cn";
import n from "../../@babel/runtime/helpers/defineProperty";

export default {
  computed: {
    globalUtils() {
      return globalUtils
    }
  },
  props: {
    div_gps: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      mask_class: '',
      div_vip: '',
      div_vip_H: 0,
      div_vip_title: '',
      div_vip_content: '',
      div_cert: '',
      div_cert_title: '',
      div_data: '',
      div_data_title: '',
      div_gps_title: '',
      address: {},
    }
  },
  mounted() {

  },
  methods: {
    // 取消获取
    /* mask_closeFn: function (t) {
          console.log('取消获取')
          uni.navigateBack();
        },*/
    mask_closeFn: function (t) {
      var that = this;
      var e = t.currentTarget.dataset.maskid;
      this.setData({
        mask_class: 'alpha100_0'
      });
      setTimeout(function () {
        that.setData(n({}, e, false));
      }, 500);
    },
    // 认证
    certFn: function () {
      uni.navigateTo({
        url: '/myPages/cert/cert'
      });
    },

    emptyFn() {
      console.log('占位：函数 emptyFn 未声明');
    },

    // 开通Vip
    vipFn: function () {
      app.globalData.chklogin().then(function (a) {
        a
            ? uni.navigateTo({
              url: '/pagesA/my_vip/my_vip'
            })
            : uni.navigateTo({
              url: '/pages/login/login'
            });
      });
    },
    // 资料认证
    dataFn: function () {
      uni.navigateTo({
        url: '/pagesA/reg/reg'
      });
    },
    // 获取位置
    gpsFn: function () {
      var that = this;
      uni.getFuzzyLocation({
        success: function (e) {
          that.address = e
          that.div_gps = false
          console.log('定位获取待的值', e)
        },
        fail: function (a) {
          console.log('位置报什么错', a)
          'getFuzzyLocation:fail system permission denied' === a.errMsg
              ? uni.showModal({
                content: '亲，请开启手机定位再来操作哦',
                confirmColor: that.color,
                confirmText: '朕知道了',
                showCancel: false,
                success: function (a) {
                }
              })
              : uni.showModal({
                content: '请设置：位置信息 > 使用小程序时允许',
                success: function (a) {
                  if (a.confirm) {
                    uni.openSetting({
                      success: function (a) {
                        console.log(a.authSetting);
                        a.authSetting = {
                          'scope.userInfo': true,
                          'scope.userLocation': true
                        };
                      }
                    });
                  }
                }
              });
        }
      });
    },
  }
}
</script>

<style>
@import 'sorry.css';
</style>
